<%--
  Created by IntelliJ IDEA.
  User: WDD
  Date: 2019/5/14
  Time: 21:39
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="keys" content="">
    <meta name="author" content="">
    <link rel="stylesheet" href="${APP_PATH}/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="${APP_PATH}/css/font-awesome.min.css">
    <link rel="stylesheet" href="${APP_PATH}/css/login.css">
    <style>

    </style>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
    <div class="container">
        <div class="navbar-header">
            <div><a class="navbar-brand" href="${APP_PATH}/index.htm" style="font-size:32px;">尚筹网-创意产品众筹平台</a></div>
        </div>
    </div>
</nav>

<div class="container">

    <form id="regForm" class="form-signin" role="form">
        <h2 class="form-signin-heading"><i class="glyphicon glyphicon-log-in"></i> 用户注册</h2>
        <div class="form-group has-success has-feedback">
            <input type="text" class="form-control" id="inputSuccess4" name="loginacct" placeholder="请输入登录账号" autofocus>
            <span class="glyphicon glyphicon-user form-control-feedback"></span>
        </div>
        <div class="form-group has-success has-feedback">
            <input type="text" class="form-control" id="inputSuccess4" name="userpswd" placeholder="请输入登录密码" style="margin-top:10px;">
            <span class="glyphicon glyphicon-lock form-control-feedback"></span>
        </div>
        <div class="form-group has-success has-feedback">
            <input type="text" class="form-control" id="inputSuccess4" name="username" placeholder="请输入用户名" autofocus>
            <span class="glyphicon glyphicon-user form-control-feedback"></span>
        </div>
        <div class="form-group has-success has-feedback">
            <input type="text" class="form-control" id="inputSuccess4" name="email" placeholder="请输入邮箱地址" style="margin-top:10px;">
            <span class="glyphicon glyphicon glyphicon-envelope form-control-feedback"></span>
        </div>
        <div class="form-group has-success has-feedback">
            <select class="form-control" name="usertype" >
                <option value="1">企业</option>
                <option value="0">个人</option>
            </select>
        </div>
        <div>
            <input type="text" class="form-control" id="inputSuccess4" name="check" placeholder="请输入验证码" style=" display:inline-block;width:100px;height:40px;">
            <img id="cpacha-img" title="点击切换验证码" style="cursor:pointer; display:inline-block;margin-left: 10px;border:solid 1px darkgrey" src="${APP_PATH}/checkCode.do" width="85px" height="38px" onclick="changeCheckCode(this)">
            <span><h1 id="message"></h1></span>
        </div>
        <div class="checkbox">
            <label>
                忘记密码
            </label>
            <label style="float:right">
                <a href="${APP_PATH}/login.htm">我有账号</a>
            </label>
        </div>
        <a class="btn btn-lg btn-success btn-block" onclick="doreg()" > 注册</a>
    </form>
</div>
<script src="${APP_PATH}/jquery/jquery-2.1.1.min.js"></script>
<script src="${APP_PATH}/bootstrap/js/bootstrap.min.js"></script>
<script>

    //图片点击事件
    function changeCheckCode(img) {
        img.src="${APP_PATH}/checkCode.do?"+new Date().getTime();
    }

    function doreg() {
        $.ajax({
            type:"POST",
            dataType:"json",
            data:$('#regForm').serialize(),
            url:"${APP_PATH}/doReg.do",
            success:function(data) {
                if(data.success){
                    location.href="${APP_PATH}/member.htm";
                }else{
                    $("#message").text(data.message);
                    //刷新验证码
                    $("#cpacha-img").attr("src","${APP_PATH}/checkCode.do?"+new Date().getTime());
                }
            }
        })
    }
</script>
</body>
</html>